package cn.hallele.leinsteining.mc.infrastructure.metadata.io;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * 接口统一分页响应
 *
 * @author anle5
 * @since 2023/12/10 星期日 19:34
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "接口统一分页响应")
public class Page<T> implements Serializable {
    @Serial
    private static final long serialVersionUID = -3377581672342778019L;

    /**
     * 默认页码
     */
    public static final int DEFAULT_PNO = 1;

    /**
     * 默认每页数量
     */
    public static final int DEFAULT_PAGE_SIZE = 10;

    /**
     * 页码
     */
    @Schema(description = "页码")
    private Integer pageNo;

    /**
     * 每页数量
     */
    @Schema(description = "每页数量")
    private Integer pageSize;

    /**
     * 总数
     */
    @Schema(description = "总数")
    private Long totalNum;

    /**
     * 总页码
     */
    @Schema(description = "总页码")
    private Integer totalPages;

    /**
     * 数据
     */
    @Valid
    @Schema(description = "数据")
    private List<T> data;
}
